home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / compiler / ag68kgas.pas < prev    next >
Pascal/Delphi Source File  |  1998-09-24  |  27KB  |  685 lines

  1. {
  2.     $Id: ag68kgas.pas,v 1.1.1.1.2.5 1998/09/14 18:57:23 carl Exp $
  3.     Copyright (c) 1998 by the FPC development team
  4.  
  5.     This unit implements an asmoutput class for MOTOROLA syntax with
  6.     Motorola 68000 (for GAS v2.52 AND HIGER)
  7.  
  8.     This program is free software; you can redistribute it and/or modify
  9.     it under the terms of the GNU General Public License as published by
  10.     the Free Software Foundation; either version 2 of the License, or
  11.     (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  ****************************************************************************
  23.  
  24.   What's to do:
  25.     o Verify if this actually work as indirect mode with name of variables
  26.     o write lines numbers and file names to output file
  27.     o generate debugging informations
  28. }
  29. unit ag68kgas;
  30.  
  31.     interface
  32.  
  33.     uses aasm,assemble;
  34.  
  35.     type
  36.       pm68kgasasmlist=^tm68kgasasmlist;
  37.       tm68kgasasmlist = object(tasmlist)
  38.         procedure WriteTree(p:paasmoutput);virtual;
  39.         procedure WriteAsmList;virtual;
  40.       end;
  41.  
  42.    implementation
  43.  
  44.     uses
  45.       dos,globals,systems,cobjects,m68k,
  46.       strings,files,verbose
  47. {$ifdef GDB}
  48.       ,gdb
  49. {$endif GDB}
  50.       ;
  51.  
  52.     const
  53.       line_length = 70;
  54.  
  55.     var
  56.       infile : pextfile;
  57.       includecount,lastline : longint;
  58.  
  59.     function getreferencestring(const ref : treference) : string;
  60.       var
  61.          s : string;
  62.       begin
  63.          s:='';
  64.          if ref.isintvalue then
  65.              s:='#'+tostr(ref.offset)
  66.          else
  67.            with ref do
  68.              begin
  69.                 if assigned(symbol) then
  70.                   s:=s+symbol^;
  71.  
  72.                 if offset<0 then s:=s+tostr(offset)
  73.                   else if (offset>0) then
  74.                     begin
  75.                        if (symbol=nil) then s:=tostr(offset)
  76.                        else s:=s+'+'+tostr(offset);
  77.                     end;
  78.                if (index<>R_NO) and (base=R_NO) and (direction=dir_none) then
  79.                 begin
  80.                   if (scalefactor = 1) or (scalefactor = 0) then
  81.                     s:=s+'(,'+gas_reg2str[index]+'.l)'
  82.                   else
  83.                     s:=s+'(,'+gas_reg2str[index]+'.l*'+tostr(scalefactor)+')'
  84.                 end
  85.                 else if (index=R_NO) and (base<>R_NO) and (direction=dir_inc) then
  86.                 begin
  87.                   if (scalefactor = 1) or (scalefactor = 0) then
  88.                       s:=s+'('+gas_reg2str[base]+')+'
  89.                   else
  90.                    InternalError(10002);
  91.                 end
  92.                 else if (index=R_NO) and (base<>R_NO) and (direction=dir_dec) then
  93.                 begin
  94.                   if (scalefactor = 1) or (scalefactor = 0) then
  95.                       s:=s+'-('+gas_reg2str[base]+')'
  96.                   else
  97.                    InternalError(10003);
  98.                 end
  99.                   else if (index=R_NO) and (base<>R_NO) and (direction=dir_none) then
  100.                 begin
  101.                   s:=s+'('+gas_reg2str[base]+')'
  102.                 end
  103.                   else if (index<>R_NO) and (base<>R_NO) and (direction=dir_none) then
  104.                 begin
  105.                   if (scalefactor = 1) or (scalefactor = 0) then
  106.                     s:=s+'('+gas_reg2str[base]+','+gas_reg2str[index]+'.l)'
  107.                   else
  108.                     s:=s+'('+gas_reg2str[base]+','+gas_reg2str[index]+'.l*'+tostr(scalefactor)+')';
  109.                 end;
  110.             end; { end with }
  111.          getreferencestring:=s;
  112.       end;
  113.  
  114.     function getopstr(t : byte;o : pointer) : string;
  115.  
  116.       var
  117.          hs : string;
  118.          i: tregister;
  119.  
  120.       begin
  121.          case t of
  122.             top_reg : if target_info.target=target_PalmOS then
  123.                         getopstr:=gasPalmOS_reg2str[tregister(o)]
  124.                       else
  125.                         getopstr:=gas_reg2str[tregister(o)];
  126.                top_ref : getopstr:=getreferencestring(preference(o)^);
  127.          top_reglist: begin
  128.                       hs:='';
  129.                       for i:=R_NO to R_FPSR do
  130.                       begin
  131.                         if i in tregisterlist(o^) then
  132.                          hs:=hs+gas_reg2str[i]+'/';
  133.                       end;
  134.                       delete(hs,length(hs),1);
  135.                       getopstr := hs;
  136.                     end;
  137.              top_const : getopstr:='#'+tostr(longint(o));
  138.             top_symbol :
  139.                     { compare with i386, where a symbol is considered }
  140.                     { a constant.                                     }
  141.                     begin
  142.                      hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  143.                             move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  144. {                           inc(byte(hs[0]));}
  145.                             if pcsymbol(o)^.offset>0 then
  146.                               hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  147.                             else if pcsymbol(o)^.offset<0 then
  148.                               hs:=hs+tostr(pcsymbol(o)^.offset);
  149.                             getopstr:=hs;
  150.                          end;
  151.             else internalerror(10001);
  152.          end;
  153.       end;
  154.  
  155.     function getopstr_jmp(t : byte;o : pointer) : string;
  156.  
  157.       var
  158.          hs : string;
  159.  
  160.       begin
  161.          case t of
  162.             top_reg : getopstr_jmp:=gas_reg2str[tregister(o)];
  163.             top_ref : getopstr_jmp:=getreferencestring(preference(o)^);
  164.             top_const : getopstr_jmp:=tostr(longint(o));
  165.             top_symbol : begin
  166.                             hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  167.                             move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  168.                             if pcsymbol(o)^.offset>0 then
  169.                               hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  170.                             else if pcsymbol(o)^.offset<0 then
  171.                               hs:=hs+tostr(pcsymbol(o)^.offset);
  172.                             getopstr_jmp:=hs;
  173.                          end;
  174.             else internalerror(10001);
  175.          end;
  176.       end;
  177.  
  178. {****************************************************************************
  179.                              T68kGASASMOUTPUT
  180.  ****************************************************************************}
  181.  
  182.     var
  183.        { different types of source lines }
  184.        n_line : byte;
  185.  
  186.     const
  187.       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
  188.         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
  189.  
  190.     procedure tm68kgasasmlist.WriteTree(p:paasmoutput);
  191.     var
  192.       hp        : pai;
  193.       ch        : char;
  194.       consttyp  : tait;
  195.       s         : string;
  196.       pos,l,i   : longint;
  197.       found     : boolean;
  198. {$ifdef GDB}
  199.       funcname  : pchar;
  200.       linecount : longint;
  201. {$endif GDB}
  202.     begin
  203. {$ifdef GDB}
  204.       funcname:=nil;
  205.       linecount:=1;
  206. {$endif GDB}
  207.       hp:=pai(p^.first);
  208.       while assigned(hp) do
  209.        begin
  210.        { write debugger informations }
  211. {$ifdef GDB}
  212.          if cs_debuginfo in aktswitches then
  213.           begin
  214.             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,ait_stab_function_name]) then
  215.              begin
  216.                if assigned(hp^.infile) and (pextfile(hp^.infile)<>infile)  then
  217.                 begin
  218.                   infile:=hp^.infile;
  219.                   inc(includecount);
  220.                   if (hp^.infile^.path^<>'') then
  221.                    begin
  222.                      AsmWriteLn(#9'.stabs "'+FixPath(hp^.infile^.path^)+'",'+tostr(n_includefile)+
  223.                                 ',0,0,Ltext'+ToStr(IncludeCount));
  224.                    end;
  225.                   AsmWriteLn(#9'.stabs "'+FixFileName(hp^.infile^.name^+hp^.infile^.ext^)+'",'+tostr(n_includefile)+
  226.                              ',0,0,Ltext'+ToStr(IncludeCount));
  227.                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
  228.                 end;
  229.               { file name must be there before line number ! }
  230.                if (hp^.line<>lastline) and (hp^.line<>0) then
  231.                 begin
  232.                   if (n_line = n_textline) and assigned(funcname) and
  233.                      (target_info.use_function_relative_addresses) then
  234.                    begin
  235.                      AsmWriteLn(target_info.labelprefix+'l'+tostr(linecount)+':');
  236.                      AsmWriteLn(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.line)+','+
  237.                                 target_info.labelprefix+'l'+tostr(linecount)+' - '+StrPas(FuncName));
  238.                      inc(linecount);
  239.                    end
  240.                   else
  241.                    AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.line));
  242.                   lastline:=hp^.line;
  243.                 end;
  244.              end;
  245.           end;
  246. {$endif GDB}
  247.  
  248.          case hp^.typ of
  249.        ait_comment,
  250.       ait_external : ; { external is ignored }
  251.          ait_align : AsmWriteLn(#9'.align '+tostr(pai_align(hp)^.aligntype));
  252.      ait_datablock : begin
  253.                        { ------------------------------------------------------- }
  254.                        { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  255.                        { ------------- REQUIREMENT FOR 680x0 ------------------- }
  256.                        { ------------------------------------------------------- }
  257.                        if pai_datablock(hp)^.size <> 1 then
  258.                         begin
  259.                           if not(cs_littlesize in aktswitches) then
  260.                            AsmWriteLn(#9#9'.align 4')
  261.                           else
  262.                            AsmWriteLn(#9#9'.align 2');
  263.                         end;
  264.                        if pai_datablock(hp)^.is_global then
  265.                         AsmWrite(#9'.comm'#9)
  266.                        else
  267.                         AsmWrite(#9'.lcomm'#9);
  268.                        AsmWriteLn(StrPas(pai_datablock(hp)^.name)+','+tostr(pai_datablock(hp)^.size));
  269.                      end;
  270.    ait_const_32bit, { alignment is required for 16/32 bit data! }
  271.    ait_const_16bit:  begin
  272.                        AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  273.                        consttyp:=hp^.typ;
  274.                        l:=0;
  275.                        repeat
  276.                          found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  277.                          if found then
  278.                           begin
  279.                             hp:=Pai(hp^.next);
  280.                             s:=','+tostr(pai_const(hp)^.value);
  281.                             AsmWrite(s);
  282.                             inc(l,length(s));
  283.                           end;
  284.                        until (not found) or (l>line_length);
  285.                        AsmLn;
  286.                      end;
  287.     ait_const_8bit : begin
  288.                        AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  289.                        consttyp:=hp^.typ;
  290.                        l:=0;
  291.                        repeat
  292.                          found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  293.                          if found then
  294.                           begin
  295.                             hp:=Pai(hp^.next);
  296.                             s:=','+tostr(pai_const(hp)^.value);
  297.                             AsmWrite(s);
  298.                             inc(l,length(s));
  299.                           end;
  300.                        until (not found) or (l>line_length);
  301.                        AsmLn;
  302.                      end;
  303.   ait_const_symbol : Begin
  304.                        AsmWriteLn(#9'.long'#9+StrPas(pchar(pai_const(hp)^.value)));
  305.                      end;
  306.     ait_real_64bit : Begin
  307.                       AsmWriteLn(#9'.double'#9+double2str(pai_double(hp)^.value));
  308.                      end;
  309.     ait_real_32bit : Begin
  310.                       AsmWriteLn(#9'.single'#9+double2str(pai_single(hp)^.value));
  311.                      end;
  312.  ait_real_extended : Begin
  313.                       AsmWriteLn(#9'.extend'#9+double2str(pai_extended(hp)^.value));
  314.                      { comp type is difficult to write so use double }
  315.                      end;
  316.           ait_comp : Begin
  317.                        AsmWriteLn(#9'.double'#9+comp2str(pai_extended(hp)^.value));
  318.                      end;
  319.         ait_direct : begin
  320.                        AsmWritePChar(pai_direct(hp)^.str);
  321.                        AsmLn;
  322. {$IfDef GDB}
  323.                        if strpos(pai_direct(hp)^.str,'.data')<>nil then
  324.                          n_line:=n_dataline
  325.                        else if strpos(pai_direct(hp)^.str,'.text')<>nil then
  326.                          n_line:=n_textline
  327.                        else if strpos(pai_direct(hp)^.str,'.bss')<>nil then
  328.                          n_line:=n_bssline;
  329. {$endif GDB}
  330.                      end;
  331.         ait_string : begin
  332.                        pos:=0;
  333.                        for i:=1 to pai_string(hp)^.len do
  334.                         begin
  335.                           if pos=0 then
  336.                            begin
  337.                              AsmWrite(#9'.ascii'#9'"');
  338.                              pos:=20;
  339.                            end;
  340.                           ch:=pai_string(hp)^.str[i-1];
  341.                           case ch of
  342.                              #0, {This can't be done by range, because a bug in FPC}
  343.                         #1..#31,
  344.                      #128..#255 : s:='\'+tostr(ord(ch) shr 6)+tostr((ord(ch) and 63) shr 3)+tostr(ord(ch) and 7);
  345.                             '"' : s:='\"';
  346.                             '\' : s:='\\';
  347.                           else
  348.                            s:=ch;
  349.                           end;
  350.                           AsmWrite(s);
  351.                           inc(pos,length(s));
  352.                           if (pos>line_length) or (i=pai_string(hp)^.len) then
  353.                            begin
  354.                              AsmWriteLn('"');
  355.                              pos:=0;
  356.                            end;
  357.                         end;
  358.                      end;
  359.          ait_label : begin
  360.                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
  361.                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_const_symbol,
  362.                            ait_real_64bit,ait_real_32bit,ait_string]) then
  363.                         begin
  364.                           if not(cs_littlesize in aktswitches) then
  365.                            AsmWriteLn(#9#9'.align 4')
  366.                           else
  367.                            AsmWriteLn(#9#9'.align 2');
  368.                         end;
  369.                        if (pai_label(hp)^.l^.is_used) then
  370.                         AsmWriteLn(lab2str(pai_label(hp)^.l)+':');
  371.                      end;
  372. ait_labeled_instruction : begin
  373.                      { labeled operand }
  374.                        if pai_labeled(hp)^._op1 = R_NO then
  375.                         AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab))
  376.                        else
  377.                      { labeled operand with register }
  378.                         AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+
  379.                                  reg2str(pai_labeled(hp)^._op1)+','+lab2str(pai_labeled(hp)^.lab))
  380.                      end;
  381.         ait_symbol : begin
  382.                        { ------------------------------------------------------- }
  383.                        { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  384.                        { ------------- REQUIREMENT FOR 680x0 ------------------- }
  385.                        { ------------------------------------------------------- }
  386.                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
  387.                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_const_symbol,
  388.                            ait_real_64bit,ait_real_32bit,ait_string]) then
  389.                         begin
  390.                           if not(cs_littlesize in aktswitches) then
  391.                            AsmWriteLn(#9#9'.align 4')
  392.                           else
  393.                            AsmWriteLn(#9#9'.align 2');
  394.                         end;
  395.                        if pai_symbol(hp)^.is_global then
  396.                         AsmWriteLn('.globl '+StrPas(pai_symbol(hp)^.name));
  397.                        AsmWriteLn(StrPas(pai_symbol(hp)^.name)+':');
  398.                      end;
  399.    ait_instruction : begin
  400.                        { old versions of GAS don't like PEA.L and LEA.L }
  401.                        if (pai68k(hp)^._operator in [
  402.                             A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
  403.                             A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
  404.                             A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
  405.                             A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
  406.                         s:=#9+mot_op2str[pai68k(hp)^._operator]
  407.                        else
  408.                          if target_info.target=target_PalmOS then
  409.                            s:=#9+mot_op2str[pai68k(hp)^._operator]+gas_opsize2str[pai68k(hp)^.size]
  410.                          else
  411.                            s:=#9+mot_op2str[pai68k(hp)^._operator]+mit_opsize2str[pai68k(hp)^.size];
  412.                        if pai68k(hp)^.op1t<>top_none then
  413.                         begin
  414.                         { call and jmp need an extra handling                          }
  415.                         { this code is only callded if jmp isn't a labeled instruction }
  416.                           if pai68k(hp)^._operator in [A_JSR,A_JMP] then
  417.                            s:=s+#9+getopstr_jmp(pai68k(hp)^.op1t,pai68k(hp)^.op1)
  418.                           else
  419.                            if pai68k(hp)^.op1t = top_reglist then
  420.                             s:=s+#9+getopstr(pai68k(hp)^.op1t,@(pai68k(hp)^.reglist))
  421.                            else
  422.                             s:=s+#9+getopstr(pai68k(hp)^.op1t,pai68k(hp)^.op1);
  423.                            if pai68k(hp)^.op2t<>top_none then
  424.                             begin
  425.                               if pai68k(hp)^.op2t = top_reglist then
  426.                                s:=s+','+getopstr(pai68k(hp)^.op2t,@pai68k(hp)^.reglist)
  427.                               else
  428.                                s:=s+','+getopstr(pai68k(hp)^.op2t,pai68k(hp)^.op2);
  429.                             { three operands }
  430.                               if pai68k(hp)^.op3t<>top_none then
  431.                                begin
  432.                                    if (pai68k(hp)^._operator = A_DIVSL) or
  433.                                       (pai68k(hp)^._operator = A_DIVUL) or
  434.                                       (pai68k(hp)^._operator = A_MULU) or
  435.                                       (pai68k(hp)^._operator = A_MULS) or
  436.                                       (pai68k(hp)^._operator = A_DIVS) or
  437.                                       (pai68k(hp)^._operator = A_DIVU) then
  438.                                     s:=s+':'+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3)
  439.                                    else
  440.                                     s:=s+','+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3);
  441.                                end;
  442.                             end;
  443.                         end;
  444.                        AsmWriteLn(s);
  445.                      end;
  446. {$ifdef GDB}
  447.          ait_stabs : begin
  448.                        AsmWrite(#9'.stabs ');
  449.                        AsmWritePChar(pai_stabs(hp)^.str);
  450.                        AsmLn;
  451.                      end;
  452.          ait_stabn : begin
  453.                        AsmWrite(#9'.stabn ');
  454.                        AsmWritePChar(pai_stabn(hp)^.str);
  455.                        AsmLn;
  456.                      end;
  457. ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
  458. {$endif GDB}
  459.          else
  460.           internalerror(10000);
  461.          end;
  462.          hp:=pai(hp^.next);
  463.        end;
  464.     end;
  465.  
  466.     procedure tm68kgasasmlist.WriteAsmList;
  467. {$ifdef GDB}
  468.     var
  469.       p,n,e : string;
  470. {$endif}
  471.     begin
  472. {$ifdef EXTDEBUG}
  473.       if assigned(current_module^.mainsource) then
  474.        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
  475. {$endif}
  476.       infile:=nil;
  477.       includecount:=0;
  478. {$ifdef GDB}
  479.       if assigned(current_module^.mainsource) then
  480.        fsplit(current_module^.mainsource^,p,n,e)
  481.       else
  482.        begin
  483.          p:=inputdir;
  484.          n:=inputfile;
  485.          e:=inputextension;
  486.        end;
  487.     { to get symify to work }
  488.       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
  489.     { stabs }
  490.       n_line:=n_bssline;
  491.       if (cs_debuginfo in aktswitches) then
  492.        begin
  493.          if (p<>'') then
  494.           AsmWriteLn(#9'.stabs "'+FixPath(p)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  495.          AsmWriteLn(#9'.stabs "'+FixFileName(n+e)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  496.          AsmWriteLn('Ltext0:');
  497.        end;
  498.       infile:=current_module^.sourcefiles.files;
  499. {$endif GDB}
  500.  
  501.     { main source file is last in list }
  502.       while assigned(infile^._next) do
  503.        infile:=infile^._next;
  504.       lastline:=0;
  505.       { there should be nothing but externals so we don't need to process
  506.       WriteTree(externals); }
  507.       WriteTree(debuglist);
  508.  
  509.     { code segment }
  510.       AsmWriteln('.text');
  511. {$ifdef GDB}
  512.       n_line:=n_textline;
  513. {$endif GDB}
  514.       WriteTree(codesegment);
  515.  
  516.       AsmWriteLn('.data');
  517. {$ifdef EXTDEBUG}
  518.       AsmWriteLn(#9'.ascii'#9'"compiled by FPC '+version_string+'\0"');
  519.       AsmWriteLn(#9'.ascii'#9'"target: '+target_info.target_name+'\0"');
  520. {$endif EXTDEBUG}
  521. {$ifdef GDB}
  522.       n_line:=n_dataline;
  523. {$endif GDB}
  524.       DataSegment^.insert(new(pai_align,init(4)));
  525.       WriteTree(datasegment);
  526.       WriteTree(consts);
  527.  
  528.     { makes problems with old GNU ASes
  529.       AsmWriteLn('.bss');
  530.       bssSegment^.insert(new(pai_align,init(4))); }
  531. {$ifdef GDB}
  532.       n_line:=n_bssline;
  533. {$endif GDB}
  534.       WriteTree(bsssegment);
  535.  
  536.       AsmLn;
  537. {$ifdef EXTDEBUG}
  538.       if assigned(current_module^.mainsource) then
  539.        comment(v_info,'Done writing gas-styled assembler output for '+current_module^.mainsource^);
  540. {$endif EXTDEBUG}
  541.     end;
  542.  
  543. end.
  544. {
  545.   $Log: ag68kgas.pas,v $
  546.   Revision 1.1.1.1.2.5  1998/09/14 18:57:23  carl
  547.     * byte alignment
  548.  
  549.   Revision 1.1.1.1.2.4  1998/08/13 17:41:18  florian
  550.     + some stuff for the PalmOS added
  551.  
  552.   Revision 1.1.1.1.2.3  1998/07/01 13:58:44  carl
  553.      ?
  554.  
  555.   Revision 1.1.1.1  1998/03/25 11:18:16  root
  556.   * Restored version
  557.  
  558.   Revision 1.3  1998/03/22 12:45:37  florian
  559.     * changes of Carl-Eric to m68k target commit:
  560.       - wrong nodes because of the new string cg in intel, I had to create
  561.         this under m68k also ... had to work it out to fix potential alignment
  562.         problems --> this removes the crash of the m68k compiler.
  563.       - added absolute addressing in m68k assembler (required for Amiga startup)
  564.       - fixed alignment problems (because of byte return values, alignment
  565.         would not be always valid) -- is this ok if i change the offset if odd in
  566.         setfirsttemp ?? -- it seems ok...
  567.  
  568.   Revision 1.2  1998/03/10 04:22:08  carl
  569.     - removed in as it can cause range check errors under BP
  570.  
  571.   Revision 1.1  1998/03/10 01:26:10  peter
  572.     + new uniform names
  573.  
  574.   Revision 1.18  1998/03/09 12:58:10  peter
  575.     * FWait warning is only showed for Go32V2 and $E+
  576.     * opcode tables moved to i386.pas/m68k.pas to reduce circular uses (and
  577.       for m68k the same tables are removed)
  578.     + $E for i386
  579.  
  580.   Revision 1.17  1998/03/06 00:52:18  peter
  581.     * replaced all old messages from errore.msg, only ExtDebug and some
  582.       Comment() calls are left
  583.     * fixed options.pas
  584.  
  585.   Revision 1.16  1998/03/02 01:48:33  peter
  586.     * renamed target_DOS to target_GO32V1
  587.     + new verbose system, merged old errors and verbose units into one new
  588.       verbose.pas, so errors.pas is obsolete
  589.  
  590.   Revision 1.15  1998/02/23 03:00:00  carl
  591.     * bugfix when compiling with extdebug defined
  592.  
  593.   Revision 1.14  1998/02/22 23:03:18  peter
  594.     * renamed msource->mainsource and name->unitname
  595.     * optimized filename handling, filename is not seperate anymore with
  596.       path+name+ext, this saves stackspace and a lot of fsplit()'s
  597.     * recompiling of some units in libraries fixed
  598.     * shared libraries are working again
  599.     + $LINKLIB <lib> to support automatic linking to libraries
  600.     + libraries are saved/read from the ppufile, also allows more libraries
  601.       per ppufile
  602.  
  603.   Revision 1.13  1998/02/21 20:20:52  carl
  604.      * make it work under older versions of GAS
  605.  
  606.   Revision 1.10  1998/02/15 21:16:19  peter
  607.     * all assembler outputs supported by assemblerobject
  608.     * cleanup with assembleroutputs, better .ascii generation
  609.     * help_constructor/destructor are now added to the externals
  610.     - generation of asmresponse is not outputformat depended
  611.  
  612.   Revision 1.9  1998/02/13 10:34:59  daniel
  613.   * Made Motorola version compilable.
  614.   * Fixed optimizer
  615.  
  616.   Revision 1.8  1998/02/12 11:50:04  daniel
  617.   Yes! Finally! After three retries, my patch!
  618.  
  619.   Changes:
  620.  
  621.   Complete rewrite of psub.pas.
  622.   Added support for DLL's.
  623.   Compiler requires less memory.
  624.   Platform units for each platform.
  625.  
  626.   Revision 1.7  1998/01/09 19:20:49  carl
  627.   + added support for mul/div 68020 syntax
  628.   * bugfix of getreferencestring
  629.  
  630.   Revision 1.4  1997/12/09 13:37:50  carl
  631.   + ait_align added
  632.   * now all non byte values are aligned correctly
  633.  
  634.   Revision 1.3  1997/12/05 14:40:49  carl
  635.   * bugfix of scaling, was incorrect under gas.
  636.  
  637.   Revision 1.2  1997/12/04 15:30:14  carl
  638.   * forgot to change name of unit! ugh...
  639.  
  640.   Revision 1.1  1997/12/03 14:04:19  carl
  641.   + renamed from gasasm6.pas to ag68kgas.pas
  642.  
  643.   Revision 1.3  1997/12/01 17:42:51  pierre
  644.      + added some more functionnality to the assembler parser
  645.  
  646.   Revision 1.2  1997/11/28 18:14:32  pierre
  647.    working version with several bug fixes
  648.  
  649.   Revision 1.1.1.1  1997/11/27 08:32:56  michael
  650.   FPC Compiler CVS start
  651.  
  652.  
  653.   Pre-CVS log:
  654.  
  655.   CEC   Carl-Eric Codere
  656.   FK    Florian Klaempfl
  657.   PM    Pierre Muller
  658.   +     feature added
  659.   -     removed
  660.   *     bug fixed or changed
  661.  
  662.   History:
  663.       30th september 1996:
  664.          + unit started (FK)
  665.       15th october 1996:
  666.          + ti386attasmoutput class started (FK)
  667.       28th november 1996:
  668.          ! debugging for simple programs (FK)
  669.       26th february 1997:
  670.          + op2str array completed with work of Daniel Manitone (FK)
  671.       25th september 1997:
  672.          * compiled by comment ifdef'ed (FK)
  673.       4th october 1997:
  674.          + converted to motorola 68000 (same sytnax as gas) (CEC)
  675.      9th october 1997:
  676.        * fixed constant bug. (CEC)
  677.        + converted from %reg to reg (untested) (CEC)
  678.      (according to gas docs, they are accepted).
  679.     28th october 1997:
  680.        * bugfix on increment/decrement mode (was never checked). (CEC)
  681.     2nd november 1997:
  682.        + added all opcodes , and they are now in correct order of
  683.          processor types. (CEC).
  684. }
  685.